package com.easylinkin.linkappapi.space.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.easylinkin.linkappapi.device.entity.DeviceVoExt;
import com.easylinkin.linkappapi.function.entity.TenantFunctionRefArea;
import com.easylinkin.linkappapi.space.entity.LinkappArea;
import com.easylinkin.linkappapi.space.entity.LinkappSpace;
import com.easylinkin.linkappapi.space.vo.SpaceTreeVo;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.web.multipart.MultipartFile;

/**
 * <p></p>
 *
 * @author liuming
 * @since 2020/4/14
 */
public interface LinkappAreaService extends IService<LinkappArea> {

    boolean addLinkappArea(LinkappArea linkappArea);

    /**
     * 修改空间区域 名称，获取替换后的新的区域路径
     */
    String getReplacedNewAreaPath(String oldSpaceName, String newSpaceName);

    boolean updateLinkappArea(LinkappArea linkappArea);

    boolean deleteLinkappAreaList(Set<String> ids);

    List<LinkappArea> selectLinkappAreaList(LinkappArea linkappArea);

    List<SpaceTreeVo> selectMostChildAreaList(LinkappArea linkappArea);

    void setMostChildFlag(List<SpaceTreeVo> stvList);

    List<LinkappArea> selectAreaListByTenantId(LinkappArea linkappArea);

    LinkappArea selectLinkappArea(LinkappArea linkappArea);

    List<SpaceTreeVo> selectLinkappAreaTreeList(LinkappArea linkappArea);

    List<SpaceTreeVo> selectChildLinkappAreaTreeListByAreaPath(LinkappArea linkappArea);

    /**
     * 获取区域的子区域所关联的设备list
     * @param linkappArea
     * @return
     */
    Map<String, List<String>> getAreaRefDeviceCodeData(LinkappArea linkappArea);

    /**
     * 获取用户空间权限的各个空间下的设备
     * @return
     */
    Map<String, List<String>> getSpaceRefDeviceCodeData();

    List<LinkappArea> selectLinkappAreaLowLevlNodeList(LinkappArea linkappArea);

    void getImportTemplate(HttpServletRequest request, HttpServletResponse response);

    Set importData(MultipartFile file, LinkappSpace space);

    void exportData(LinkappArea area, HttpServletRequest request, HttpServletResponse response);

    void bindTenantAndAreaPath(DeviceVoExt adp);

    List<SpaceTreeVo> getAreaTreeListByFunctionIdentifier(TenantFunctionRefArea tfra);

    /**
     * 视频监控-树形结构(包含设备)
     */
    List<SpaceTreeVo> selectAreaTreeListWithDevice(LinkappArea linkappArea);
}
